package com.csweimei.rentmanagementtreasure.http.entity;

import com.csweimei.rentmanagementtreasure.utils.ValidateUtils;
import com.google.gson.annotations.SerializedName;

import java.util.List;

public class DealHouseListBean extends BaseResult{
    @SerializedName("data")
    private List<DataDTO> data;

    public List<DataDTO> getData() {
        return data;
    }

    public void setData(List<DataDTO> data) {
        this.data = data;
    }

    public static class DataDTO {
        @SerializedName("userid")
        private int userid;
        @SerializedName("headImg")
        private String headImg;
        @SerializedName("nickname")
        private String nickname;
        @SerializedName("housingCount")
        private int housingCount;
        @SerializedName("lList")
        private List<LListDTO> lList;

        public int getUserid() {
            return userid;
        }

        public void setUserid(int userid) {
            this.userid = userid;
        }

        public String getHeadImg() {
            return headImg;
        }

        public void setHeadImg(String headImg) {
            this.headImg = headImg;
        }

        public String getNickname() {
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        public String getHousingCount() {
            if (getLList().size() > 0){
                return "共"+getLList().size()+"套";
            }else {
                return "";
            }
        }

        public void setHousingCount(int housingCount) {
            this.housingCount = housingCount;
        }

        public List<LListDTO> getLList() {
            return lList;
        }

        public void setLList(List<LListDTO> lList) {
            this.lList = lList;
        }

        public static class LListDTO {
            @SerializedName("leaseID")
            private int leaseID;
            @SerializedName("housingImg")
            private String housingImg;
            @SerializedName("quarters")
            private String quarters;
            @SerializedName("roomname")
            private String roomname;
            @SerializedName("staTime")
            private String staTime;
            @SerializedName("endTime")
            private String endTime;

            public int getLeaseID() {
                return leaseID;
            }

            public void setLeaseID(int leaseID) {
                this.leaseID = leaseID;
            }

            public String getHousingImg() {
                if (housingImg.contains(",")){
                    return housingImg.split(",")[0];
                }else {
                    return housingImg;

                }
            }

            public void setHousingImg(String housingImg) {
                this.housingImg = housingImg;
            }

            public String getQuarters() {
                return quarters;
            }

            public void setQuarters(String quarters) {
                this.quarters = quarters;
            }

            public String getRoomname() {
                return quarters+roomname;
            }

            public void setRoomname(String roomname) {
                this.roomname = roomname;
            }

            public String getStaTime() {
                return ValidateUtils.getTimeByType(staTime,ValidateUtils.TIME_YMD)+" 至 "+ValidateUtils.getTimeByType(endTime,ValidateUtils.TIME_YMD);
            }

            public void setStaTime(String staTime) {
                this.staTime = staTime;
            }

            public String getEndTime() {
                return endTime;
            }

            public void setEndTime(String endTime) {
                this.endTime = endTime;
            }
        }
    }
}
